package model

import (
	"gorm.io/gorm"
	"hotel_3.27/variable"
)

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:char(11);not null;index:ip_idx"`
	Password string `gorm:"type:varchar(32);not null;index:ip_idx"`
}

func (u User) GetUserMobile(mobile string) (user *User, err error) {
	err = variable.DB.Take(&user).Where("mobile=?", mobile).Error
	if err != nil {
		return nil, err
	}
	return
}
